package com.ihr360.job.core;

/**
 * Exception to indicate the the job has been interrupted. The exception state
 * indicated is not normally recoverable by batch application clients, but
 * internally it is useful to force a check. The exception will often be wrapped
 * in a runtime exception (usually {@link UnexpectedJobExecutionException} before
 * reaching the client.
 *
 */
public class JobInterruptedException extends RuntimeException {
    private BatchStatus status = BatchStatus.STOPPED;

    public JobInterruptedException(String msg) {
        super(msg);
    }

    public JobInterruptedException(String msg, BatchStatus status) {
        super(msg);
        this.status = status;
    }

    /**
     * The desired status of the surrounding execution after the interruption.
     *
     * @return the status of the interruption (default STOPPED)
     */
    public BatchStatus getStatus() {
        return status;
    }
}